<html>
    <head>
        <title>原材料修改</title>
        <link href="{$Think.const.ADMIN_CSS_URL}bootstrap.css" rel="stylesheet" />
        <link href="{$Think.const.ADMIN_CSS_URL}lz-style.css" rel="stylesheet" />
        <script src="{$Think.const.ADMIN_JS_URL}jquery.js"></script>
        <script src="{$Think.const.ADMIN_JS_URL}jquery.form.js"></script>
        <script src="{$Think.const.ADMIN_JS_URL}bootstrap.js"></script>
        <script src="{$Think.const.ADMIN_JS_URL}DatePicker/WdatePicker.js"></script>
        <script language="JavaScript">

            $(function () {
                $('#editform').ajaxForm({
                    beforeSubmit: checkForm, // pre-submit callback
                    success: complete, // post-submit callback
                    dataType: 'json'
                });
                function checkForm() {

                    if ('' == $.trim($('#MaterialTypeID').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALTYPEID}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialTypeName').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALTYPENAME}]不能为空').show();
                        return false;
                    }

                    if ('' == $.trim($('#MaterialTypeDesc').val())) {
                        $('#success').hide();
                        $('#error').html('[{$Think.const.LB_MATERIALTYPEDESC}]不能为空').show();
                        return false;
                    }

                }
                function complete(data) {
                    if (data.status === 1) {
                        $('#error').hide();
                        $('#success').html(data.info).show();
                    } else {
                        $('#success').hide();
                        $('#error').html(data.info).show();
                    }
                }

            });

        </script>

    </head>
    <body>
        <div class="container">
            <div class="row div_head" >
                <div class=" col-xs-6 col-sm-6 text-primary">
                    {$loction}
                </div>
                <div class="col-xs-6 col-sm-3"></div>
                <div class="col-xs-6 col-sm-3">
                    <a style="text-decoration: none" href="__CONTROLLER__/lst">【返回】</a>
                </div>
            </div>

            <hr />
            <div class="row div_form" >
                <form id="editform" action="__SELF__" method="post">

                    <input type="hidden" id="MaterialTypeID" name="MaterialTypeID"  value="{$post.materialtypeid}" />

                    <div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialTypeName" class="control-label">{$Think.const.LB_MATERIALTYPENAME}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialTypeName" name="MaterialTypeName" class="form-control" placeholder="{$Think.const.LB_MATERIALTYPENAME}"  value="{$post.materialtypename}" maxlength="100"   required />
                    </div>
                    <div class="text-right col-xs-6 col-sm-3 div_required" ><label for="MaterialTypeDesc" class="control-label">{$Think.const.LB_MATERIALTYPEDESC}:</label></div>
                    <div class="col-xs-6 col-sm-3 div_text" >
                        <input type="text" id="MaterialTypeDesc" name="MaterialTypeDesc" class="form-control" placeholder="{$Think.const.LB_MATERIALTYPEDESC}"  value="{$post.materialtypedesc}" maxlength="4000"   required />
                    </div>

                    <div class="col-xs-6 col-sm-3">
                        <input type="submit" id="search"  class="btn btn-default" value="提交">
                    </div>

                </form>
            </div>
            <div id="error" class="row text-danger"></div>
            <div id="success" class="row text-success"></div>

        </div>

    </body>
</html>
